﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace One.Framework.Util
{
    /// <summary>
    /// 리소스
    /// </summary>
    public class ResourceHelper
    {
        /// <summary>
        /// Get Resource
        /// </summary>
        /// <param name="assemblyFile">Assembly</param>
        /// <param name="resourceName">Resource Name</param>
        /// <returns></returns>
        public static object LoadResource(System.Reflection.Assembly assemblyFile, string resourceName)
        {
            string strBaseName = string.Concat(assemblyFile.GetName().Name, ".", "Properties.Resources");

            System.Resources.ResourceManager rm = new System.Resources.ResourceManager(strBaseName, assemblyFile);
            return rm.GetObject(resourceName);
        }

        /// <summary>
        /// Get Resource
        /// </summary>
        /// <param name="assemblyFile">Assembly</param>
        /// <param name="baseName">Base Name</param>
        /// <param name="resourceName">Resource Name</param>
        /// <returns></returns>
        public static object LoadResource(System.Reflection.Assembly assemblyFile, string baseName, string resourceName)
        {
            //System.Reflection.Assembly assembly = assemblyFile;
            string strBaseName = string.Concat(assemblyFile.GetName().Name, ".", baseName);

            System.Resources.ResourceManager rm = new System.Resources.ResourceManager(strBaseName, assemblyFile);
            return rm.GetObject(resourceName);
        }
    }
}
